package com.gt.util.db;

import org.beetl.core.Configuration;
import org.beetl.core.GroupTemplate;
import org.beetl.core.Template;
import org.beetl.core.resource.StringTemplateResourceLoader;

import java.io.IOException;

/**
 * @author WUREN
 * @desc Beetl模板引擎DEMO
 * @create 2019-03-07 9:02
 **/
public class BeetlDemo {
    public static void main(String[] a){
        StringTemplateResourceLoader resourceLoader = new StringTemplateResourceLoader();
        Configuration cfg = null;
        try {
            cfg = Configuration.defaultConfiguration();
            GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
            Template t = gt.getTemplate("hello,${name}");
            t.binding("name", "beetl");
            String str = t.render();
            System.out.println(str);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
